#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<functional>
using namespace std;

int Add(int a, int b)
{
	return a + b;
}
struct FAdd {
	int operator()(const int& a, const int& b)
	{
		return a + b;
	}
};

int main()
{
	function<int(int, int)> f1 = Add;
	cout << f1(1, 2) << endl;

	int a = 1;
	int b = 2;
	function<int(int, int)> f2 = FAdd();
	cout << f2(10, 2) << endl;

	/*function<int(int, int)> f3 = [](const int a,const int b) { return a + b; };
	cout << f3(10, 2) << endl;*/
	auto f4 = [=](){ return a + b; };
	cout << f4() << endl;

	return 0;
}